package com.nav.rummy.core;
import java.util.ArrayList;
import java.util.List;

public class Deck extends ArrayList<Card> {
	private static final long serialVersionUID = 1L;

	public Deck(int initialCapacity) {
		super(initialCapacity);
	}

	public Deck(List<Card> cards) {
		this.addAll(cards);
	}

	public Card remove(Rank rank, Suit suit) {
		Card card = getCard(rank, suit);
		if (card != null)
			remove(card);
		return card;
	}

	public Card getCard(Rank rank, Suit suit) {
		for (Card card : this)
			if (card.getRank() == rank && card.getSuit() == suit)
				return card;
		return null;
	}
}
